<%var body = {
	var formId = 'addForm' + object.code;
	var url = '/form/doAdd/' + object.code;
%>
 <link rel="stylesheet" href="${STATIC!}/ui2/css/admin.css" media="all">
     <link href="${CDN!STATIC!}/plugins/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
<!--     <script type="text/javascript" src="third-party/jquery.min.js"></script> -->
  <script type="text/javascript" charset="utf-8" src="${CDN!STATIC!}/plugins/umeditor/umeditor.config.js"></script>
  <script type="text/javascript" charset="utf-8" src="${CDN!STATIC!}/plugins/umeditor/umeditor.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
  <script type="text/javascript" charset="utf-8" src="${CDN!STATIC!}/plugins/umeditor/lang/zh-cn/zh-cn.js"></script>
<body>
<#form_lay id="${formId}" type="add" objectCode="${object.code}" fixed="${fixed!}" object="${object}" />



<script type="text/javascript">


var $form = $('#${formId}');
var submitNow = function(data) {
	var myform = $.getFormParasObj($form);
	myform['PAGE_TYPE'] = PAGE_TYPE;
	$.post('${url}', myform, function(result) {
		if (result.success) {
			if(result.msg == null || result.msg ==''){
				back2parent();
			}else{
				//提示完了关闭
				layer.alert(result.msg, {icon: 7,yes: function(index, layero){
				    //do something
				   
				    layer.close(index); //如果设定了yes回调，需进行手工关闭
				    back2parent();
				  },
				  cancel: function(index, layero){ 
					 
					    layer.close(index);
					  	back2parent();
					  
					} });
				
			}
			
			
			
		} else {
			//alert$.alert($pjq, result.msg);
			
			//layer.alert("操作失败:"+result.msg);
			
			layer.alert(result.msg, {icon: 2});
		}
	}, 'json');
};

function back2parent(){
	var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
	parent.layer.close(index);
	
	
	parent.reload('${object.code}_grid');
}

$(function(){
	// 禁用表单，注销事件，仅供查看
	$(document).ready(function(){
		//$(this).find('input,textarea,select').attr("readonly",true);
		//$(this).find('input,i,div').unbind();
	});
});

</script>
<%if(!isEmpty(object.diy_js!)){%>
<script type="text/javascript" src="${object.diy_js}"></script>
<%}%>
</body>
<%};include("/eova/layout/default_lay.html",{'title' : '新增' + object.name, 'layoutContent' : body, 'isEditor' : true,'type':'add'}){}%>
